<script>
import { mapGetters, mapState, mapMutations,mapActions  } from "vuex";
export default {
  computed: {
    doneTodosCount() {
      console.log(this);
      return this.$store.state.home.todos.filter(todo => todo.done).length;
    },
    ...mapGetters([
      "getTodoById",
      "anotherGetter"
      // ...
    ]),
    ...mapState({
        "todos":state=>state.home.todos,
        "isFold":state=>state.home.isFold,
        "name":state=>state.home.name,
        "age":state=>state.home.age
    })
  },
  methods: {
    ...mapMutations(["changeSlideState", "changeAge"])  ,
    ...mapActions(["actionsIncrement"])
  },
  created() {
    this.actionsIncrement(100000);
    this.$store.dispatch("actionFn")
    this.$store.commit("mutationsFn")
  }
};
</script>



<template>

<div>
    
    大家爱好，我是&nbsp;&nbsp;&nbsp;首页&nbsp;
    <p>"doneTodosCount":{{doneTodosCount}}</p>
    <p>getTodoById:{{getTodoById(1)}}</p>
    <p>anotherGetter:{{anotherGetter}}</p>
    <p>todos:{{todos}}</p>
    <p>isFold:{{isFold?"true":"false"}}</p>
    <p>name:{{name}}</p>
    <p>age:{{age}}</p>
</div>
  
</template>



<style lang="stylus">
</style>
